java中object转数组 | 您所在的位置:网站首页 › java list转换为数组 › java中object转数组 |
java 中 object 转数组 _ 在 Java 中将 Object[] 数组转换为 int[] 数组? 似乎没有简单的⽅法可以做到这⼀点,但这是我到⽬前为⽌所做的,如果有⼈能够纠正它,使其⼯作将是伟⼤的.在“newarray [e] = array [i] .intValue();”我收到⼀个错误“没有命名⽅法”intValue“在类型” java.lang.Object“中找到.” 救命! /* Description: A game that displays digits 0-9 and asks the user for a number N. It then reverses the first N numbers of the sequence. It continues this until all of the numbers are in order. numbers */ import hsa.Console; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Arrays; public class ReversalGame3test { static Console c; public static void main (String[] args) { c = new Console (); c.println ("3. REVERSAL GAME"); c.println (""); c.println ("Displayed below are the digits 0-9 in random order. You must then enter a"); c.println ("number N after which the computer will reverse the first N numbers in the"); c.println ("sequence. The goal of this game is to sort all of the numbers in the fewest"); c.println ("number of reversals."); c.println (""); //introduction List numbers = new ArrayList (); numbers.add ("0"); numbers.add ("1"); numbers.add ("2"); numbers.add ("3"); |
CopyRight 2018-2019 实验室设备网 版权所有 |